#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>

int main()
{
    int n;
    scanf("%d", &n);

    int arr[40][40] = { 0 };
    arr[1][n / 2 + 1] = 1;
    for (int i = 2; i <= n * n; i++)
    {
        for (int j = 1; j <= n; j++)
        {
            if (arr[1][j] == i - 1)
            {
                if (j == n)
                    arr[2][j] = i;
                else
                    arr[n][j + 1] = i;
            }
        }
        for (int j = 2; j <= n; j++)
        {
            if (arr[j][n] == i - 1)
                arr[j - 1][1] = i;
        }
        for (int j = 2; j <= n; j++)
        {
            for (int k = 1; k < n; k++)
            {
                if (arr[j][k] == i - 1)
                {
                    if (arr[j - 1][k + 1] == 0)
                        arr[j - 1][k + 1] = i;
                    else
                        arr[j + 1][k] = i;
                }
            }
        }
    }
    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= n; j++)
            printf("%d ", arr[i][j]);
        printf("\n");
    }
    return 0;
}